< previous page page_219 next page >

Page 219
This message box is generated using the following code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdSimple_Click()
   MsgBox "Press the Enter key to continue..."
End Sub
When you click the second command button on the from, youll see a different message box appear (see Figure 11.2). Adding icons to the message box reinforces what youre trying to get across to the user.
8160-0219a.gif
Figure 11.2
A 
MsgBox with the critical icon.
The critical icon is used when a fatal type of error occurs. This message box is generated using the following code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdIcon_Click()
   MsgBox "This is a message box with an icon", vbCritical
End Sub
When you click the third command button on the form, youll see the message box shown in Figure 11.3. Notice the use of the question mark icon in combination with the buttons that ask the user to respond.
8160-0219b.gif
Figure 11.3
A 
MsgBox with Yes and No buttons.
This message box is generated using the following code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdYesNo_Click()
   If MsgBox("Save the data?", vbQuestion + vbYesNo, _
            "Save") = vbYes Then
      MsgBox "You pressed the Yes button"
   Else
      MsgBox "You pressed the No button"
   End If
End Sub

 
< previous page page_219 next page >

If you like this book, buy it!